package com.rightrule.rule.constans;

import java.util.Arrays;
import java.util.Optional;

public enum OutputFieldPriorityTypeEnum {

    ENUL("ENUL", "枚举类型"),
    BIG_NUN("BIG_NUN", "大数值类型"),
    SMALL_NUM("SMALL_NUM", "小数值类型");


    private String code;
    private String desc;

    OutputFieldPriorityTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static Optional<OutputFieldPriorityTypeEnum> of(Integer code) {
        if (null == code) {
            return Optional.empty();
        }
        return Arrays.stream(values()).filter(typeEnum -> code.equals(typeEnum.getCode())).findFirst();
    }


}
